package com.kangye.enterprise.frontdesk.service.impl;

import com.kangye.enterprise.frontdesk.entity.Abst;
import com.kangye.enterprise.frontdesk.entity.Item;
import com.kangye.enterprise.frontdesk.entity.Refer;
import com.kangye.enterprise.frontdesk.mapper.AbstMapper;
import com.kangye.enterprise.frontdesk.service.AbstService;
import com.kangye.enterprise.frontdesk.util.ViewJsonObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @program: enterprise
 * @description:
 * @author: 索腾龙
 * @create: 2021-05-29 13:47
 **/
@Service
@Transactional
public class AbstServiceImpl implements AbstService {
    @Autowired
    private AbstMapper abstMapper;

    //查询全部相关专题,相关通知,相关政策
    @Override
    public ViewJsonObject<Abst> selAbst(Integer abstAbroleId) {
        List<Abst> list = abstMapper.selAbst(abstAbroleId);
        //判断list里是否有数据
        if (list.size()>0) {
            //返回json格式
            return new ViewJsonObject<Abst>(list);
        } else {
            return new ViewJsonObject<>(1, "操作失败");
        }
    }
    //查看相关专题的详情1 详细信息(索腾龙)
    @Override
    public ViewJsonObject<Abst> selAbstById(Integer abstId) {
        List<Abst> list = abstMapper.selAbstById(abstId);
        //判断list里是否有数据
        if (list.size()>0) {
            //返回json格式
            return new ViewJsonObject<Abst>(list);
        } else {
            return new ViewJsonObject<>(1, "操作失败");
        }
    }
    //查看相关专题的详情2 咨询方式(索腾龙)
    @Override
    public ViewJsonObject<Refer> selReferById(Integer referAbstId) {
        List<Refer> list = abstMapper.selReferById(referAbstId);
        //判断list里是否有数据
        if (list.size()>0) {
            //返回json格式
            return new ViewJsonObject<Refer>(list);
        } else {
            return new ViewJsonObject<>(1, "操作失败");
        }
    }
}